﻿using System;
using CoreRay;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CoreRay.Testing
{
    /// <summary>
    /// This is a test class for VertexFormatElementTest and is intended to contain all VertexFormatElementTest 
    /// Unit Tests.
    /// </summary>
    [TestClass]
    public class VertexFormatElementTest
    {
        /// <summary>
        /// A test for element name.
        /// </summary>
        [TestMethod]
        public void ElementNameTest()
        {
            VertexFormat target = new VertexFormat();
            target.AddElement("Position", typeof(Vector3));

            VertexFormatElement element = target["Position"];

            string expected = "Position";
            string actual = element.Name;

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for element type.
        /// </summary>
        [TestMethod]
        public void ElementTypeTest()
        {
            VertexFormat target = new VertexFormat();
            target.AddElement("Position", typeof(Vector3));

            VertexFormatElement element = target["Position"];

            Type expected = typeof(Vector3);
            Type actual = element.Type;

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for element size.
        /// </summary>
        [TestMethod]
        public void ElementSizeTest()
        {
            VertexFormat target = new VertexFormat();
            target.AddElement("Position", typeof(Vector3));

            VertexFormatElement element = target["Position"];

            int expected = 12;
            int actual = element.Size;

            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        /// A test for element size.
        /// </summary>
        [TestMethod]
        public void ElementSize2Test()
        {
            VertexFormat target = new VertexFormat();
            target.AddElement("TestElement", typeof(float));

            VertexFormatElement element = target["TestElement"];

            int expected = 4;
            int actual = element.Size;

            Assert.AreEqual(expected, actual);
        }
    }
}
